package com.hnust.service.impl;

import com.hnust.api.GradeListApi;
import com.hnust.api.PersonalDataApis;
import com.hnust.api.ReleaseExamApi;
import com.hnust.domain.*;
import com.hnust.service.GradeResultService;
import okhttp3.RequestBody;
import okhttp3.ResponseBody;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import retrofit2.Callback;

import java.util.List;

@Service("gradeResultService")
public class GradeResultServiceImpl implements GradeResultService {
    @Autowired
    GradeListApi gradeListApi;
    @Autowired
    ReleaseExamApi releaseExamApi;

    @Override
    public void reportResults(Callback<Result<List<GradeList>>> callback, String examCourseId, String classId) {
        gradeListApi.reportResults(examCourseId,classId).enqueue(callback);
    }

    @Override
    public void getClassName(Callback<Result<List<ClassNameAndID>>> callback, String examId) {
        gradeListApi.getClassName(examId).enqueue(callback);
    }

    @Override
    public void getClassGrade(Callback<Result<List<StudentGradReport>>> callback, String examId, String classId) {
        gradeListApi.getClassGrade(examId,classId).enqueue(callback);
    }

    @Override
    public void getPaperDocx(Callback<ResponseBody> callback, String paperId) {
        gradeListApi.getPaperDocx(paperId).enqueue(callback);
    }

    @Override
    public void getTestName(Callback<Result<String>> callback, String testid) {
        gradeListApi.getTestName(testid).enqueue(callback);
    }

    @Override
    public void exportList(Callback<ResponseBody> callback, RequestBody ssl){
        gradeListApi.getScoreList(ssl).enqueue(callback);
    }
}
